home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
vector.lha
/
vector
/
hmatrix.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-11-23
|
673b
|
33 lines
#include <hmatrix.h>
HomogenousMatrixImplement(float);
/* This is only done for HMat(float) right now because
* of the global ::adjoint method (in C, yet).
*/
#include "adjoint.h"
/* Return the adjoint of a matrix, and the determinant
* of the matrix in *det (if non-NULL).
* Negate the adjoint if the determinant of the matrix
* is < 0, to fix problems with perspective matrices.
*/
HMat(float) adjoint(const HMat(float) &m, float *det) {
HMat(float) adj;
float v;
v = ::adjoint(m, adj);
if (v < 0) {
for (int i = X; i <= W; i++)
for (int j = X; j <= W; j++)
adj[i][j] = -adj[i][j];
}
if (det)
*det = v;
return adj;
}